package com.illtamer.infinite.sillage.config.security;

import com.illtamer.infinite.sillage.util.SecurityUtil;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

/**
 * 数据库检索用户信息配置类
 * */
@Component
public class LoginAuthenticationProvider extends DaoAuthenticationProvider {

    @Resource(name = "userDetailsService")
    private UserDetailsService userDetailsService;

    @PostConstruct
    public void initProvider() {
        super.setUserDetailsService(userDetailsService);
        super.setPasswordEncoder(SecurityUtil.DEFAULT_ENCODER);
    }

}
